#include <boost/asio.hpp>
#include <iostream>

using namespace boost::asio;
using namespace boost::system;

const char *addr_str = "239.255.0.1";
constexpr short port = 30001;

int main() {
  io_context context;
  auto addr = ip::make_address(addr_str);

  ip::udp::endpoint endpoint_(addr, port);
  ip::udp::socket socket_(context, endpoint_.protocol());

  while (true) {
    socket_.async_send_to(buffer("hello"), endpoint_,
                          [](error_code ec, std::size_t /*len*/) {
                            std::cout << "err code: " << ec << std::endl;
                          });
    sleep(1);
  }
  context.run();
  return 0;
}